package com.ruiysoft.security.provider;

import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.authentication.dao.DaoAuthenticationProvider;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.core.userdetails.UserDetails;

/**
 * Created by 化增光 on 2018/10/28.
 */
public class CustomDaoAuthenticationProvider extends DaoAuthenticationProvider {
    @Override
    protected void additionalAuthenticationChecks(UserDetails user, UsernamePasswordAuthenticationToken authentication) throws AuthenticationException {
        //IUserDetails userDetails = (IUserDetails) user;
        //自定义逻辑校验校验
//        Assert.isTrue(userDetails.isEnabled(),this.messages.getMessage("111","无效的登录用户"));
//        Assert.isTrue(userDetails.isActivated(),this.messages.getMessage("111","无效的登录用户"));
        super.additionalAuthenticationChecks(user, authentication);
    }
}
